import axios from "axios";
// eslint-disable-next-line
export default {
  //获取学生数据
  get: ({ curPage, eachPage }) =>
  axios
    .get("/api/product", {
      params: {
        curPage,
        eachPage,
      },
    })
    .then(({ data }) => data),
  //新增学生数据
  add: ({ navsId,tabsId, name, count, price, desc }) =>
    axios
      .post("/api/product/add", {
        navsId,tabsId, name, count, price, desc
      })
      .then(({ data }) => data),
  //删除学生数据
  delete: (_id) =>
    axios
      .post("/api/product/remove", {
        _id
      })
      .then(({ data }) => data),
  change: (newData) => axios.put('/api/product/change', {
    ...newData
  }).then(({ data }) => data),
  // 电影查询
  searchProduct: (value) => axios.post( `/api/product/findProduct`,{
   value
}),
  //通过id获取学生数据
  getOne: (id) =>
    axios
      .get(`/api/product/findOne/${id}`, { params: { id } })
      .then(({ data }) => data),
  //通过id修改学生数据
  updateOne: (_id, data) =>
    axios
      .put(`/api/product/`, { _id, data })
      .then((response) => console.log(response)),
};